package com.reflex;

import java.lang.reflect.Method;

/**
 * Created by zhuangqi on 2016/12/20.
 */
public class ReflexTest2 {
    public static void printClassInfo(Object object) {
        Class c = object.getClass();

        Method[] methods = c.getMethods();//获取方法

        for (int i = 0; i < methods.length; i++) {
            //得到方法的返回类型
            Class returnType = methods[i].getReturnType();
            //得到参数名
            Class[] parameterTypes = methods[i].getParameterTypes();
            for (Class class1:parameterTypes){
                System.out.println("参数名"+class1.getName().equals(String.class.getName()));
            }
        }
    }

    public static void main(String[] args) {
        String s = "ss";
        printClassInfo(s);
    }
}
